<?
include_once('../conn.php');
include_once('../include/func.php');
include("../user_check.php") ;


?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>print</title>
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
<style>
.jc_lable1{
	width:120px; }
body,td,th {
	font-size: <? echo parameters(31);?>px;
	color: #333;}
	img{
		border:0;}
</style>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js"></script>
<script type="text/javascript" src="../js/jquery.PrintArea.js"></script>
<script type="text/javascript">
    jQuery(document).ready(function($) {
	  $("div#print_button").click(function(){
    $("div#myPrintArea").printArea();
});
    })
		////////
</script>

</head>

<body>

	
	<?
	
	if($_GET[action]=='order'){
	?>

<div style="width:32px; height:32px; margin-bottom:30px;"><a href="javascript:void(0);" onclick="javascript:self.close()"><img src="../images/close.png" /></a></div>
<div style="width:850px;">
<div id="myPrintArea">
<? echo parameters(29);?>
<form  name="order" method="post" action="" onSubmit="return CheckForm();"> 
<? $order = $db->select("SELECT * FROM `".tablepre."order` where `oid` = '".$_GET[oid]."'"); 
$checkmember[0][2]<>$order[0][1]?exit(ORDER_CAN_NOT_REVIEW):'';
?>
<img src="../images/ttfjpg.php?t=<? echo ORDER_DETAILS;?>&amp;bg=titlebg2.jpg&amp;z=18&amp;x=5&amp;y=22&amp;r=0&amp;b=0&amp;g=0"  />

<style>
.order_1 td{ height:25px;}

.table_td_up td{ border-top:1px #666 solid;}
.table_td_bottom td{ border-bottom:1px #666 solid;}
</style>
<table width="100%" border="0" cellspacing="0" cellpadding="2">
  <tr class="table_td_up">
    <td colspan="4" style="padding:5px;" ><? echo RECEIVER_DETAILS;?></td>
    </tr>
  <tr class="table_td_up">
    <td width="14%" align="right" bgcolor="#E3E3E3"><? echo ORDER_SN;?>：</td>
    <td width="38%" bgcolor="#E3E3E3"><? echo $order[0][4];?></td>
    <td width="12%" align="right" bgcolor="#E3E3E3"><? echo ORDER_DATE;?>：</td>
    <td width="36%" bgcolor="#E3E3E3"><? echo $order[0][11];?></td>
  </tr>
  <tr>
    <td align="right"><? echo RECEIVER_NAME;?>：</td>
    <td><? echo $order[0][5];?></td>
    <td align="right"><? echo RECEIVER_EMAIL;?>：</td>
    <td><? echo $order[0][20];?> &nbsp;</td>
  </tr>
  <tr>
      <td align="right" bgcolor="#E3E3E3"><? echo RECEIVER_TEL;?>：</td>
    <td bgcolor="#E3E3E3"><? echo $order[0][8];?>&nbsp;</td>
    <td align="right" bgcolor="#E3E3E3"><? echo RECEIVER_MOB?>：</td>
    <td bgcolor="#E3E3E3"><? echo $order[0][6];?></td>

  </tr>
  <tr>
    <td align="right"><? echo RECEIVER_ADDRESS;?>：</td>
    <td colspan="3"><? echo $order[0][7];?></td>
  </tr>
  <tr>
    <td align="right" bgcolor="#E3E3E3"><? echo RECEIVER_ZIP_CODE;?>：</td>
    <td colspan="3" bgcolor="#E3E3E3"><? echo $order[0][9];?></td>
  </tr>
  <tr class="table_td_bottom">
    <td align="right"><? echo RECEIVER_NOTE?>：</td>
    <td colspan="3"><? echo $order[0][10];?>&nbsp;</td>
    </tr>
    
        <? if($order[0][13] >= 3){ ?>
    
      <tr>
          <td colspan="4"><img src="../images/ttfjpg.php?t=<? echo ORDER_REFUND.' '.ORDER_REASON; ?>&amp;bg=titlebg2.jpg&amp;z=18&amp;x=5&amp;y=22&amp;r=0&amp;b=0&amp;g=0"  /></td>
      </tr>
      <tr>
        <td align="right" bgcolor="#E3E3E3"><? echo ORDER_REFUND.' '.ORDER_REASON; ?>：</td>
        <td colspan="3" bgcolor="#E3E3E3"><? echo $order[0][19];?></td>
      </tr>
  <? } ?>
    
  <tr>
    <td colspan="4"><img src="../images/ttfjpg.php?t=<? echo ORDER_EXPRESS; ?>&amp;bg=titlebg2.jpg&amp;z=18&amp;x=5&amp;y=22&amp;r=0&amp;b=0&amp;g=0"  /></td>
    </tr>


    
      <tr>
    <td align="right" bgcolor="#E3E3E3"><? echo ORDER_EXPRESS;?>：</td>
    <td bgcolor="#E3E3E3"><? echo $order[0][2];?></td>
    <td align="right" bgcolor="#E3E3E3"><? echo ORDER_EXPRESS_SN;?>：</td>
    <td bgcolor="#E3E3E3"><? echo $order[0][3];?></td>
  </tr>

    
    

  
</table>  
</form>
<table width="100%" border="0" cellspacing="2" cellpadding="2">
  <tr>
    <td colspan="8"><img src="../images/ttfjpg.php?t=<? echo PRODUCT_DETAIL;?>&amp;bg=titlebg2.jpg&amp;z=18&amp;x=5&amp;y=22&amp;r=0&amp;b=0&amp;g=0"  /></td>
  </tr>  <?


	$array_stock = $db->select("SELECT * FROM `".tablepre."order_item` where `oid` = '".$_GET[oid]."' group by sid ");
	//print_r($array_stock);
	for($i=0;$i<count($array_stock);$i++){
  ?>
  <tr>
    <td colspan="9" bgcolor="#666666"><font color="#FFFFFF"><? echo stock($array_stock[$i][3],1); ?></font></td>
  <tr>  <tr class="order_1">
    <td valign="top" style="width:70px;"><div style="position:absolute;"><a href="<? echo pic_return(attachment(1,$array_stock[$i][3],'pic'));  ?>" target="_blank"><img src="<? echo pic_return(attachment(1,$array_stock[$i][3],'pic'));  ?>"  height="50" /></a></div></td>
  <td><? echo PRODUCT_BATCH_NO;?></td>
    <td><? echo PRODUCT_MODEL;?></td>
    <td><? echo PRODUCT_QUANTITY;?></td>
    <td><? echo PRODUCT_MATERIAL;?></td>
    <td><? echo PRODUCT_COLOR;?></td>
    <td><? echo PRODUCT_SIZE;?></td>
    <td><? echo ORDER_UNIT_PRICE;?></td>
    <td><? echo ORDER_TOTAL_QTY;?></td>
  </tr>
  <?
  $cart_item = $db->select("SELECT * FROM `".tablepre."order_item` where `sid` = '".$array_stock[$i][3]."'  and `oid` = '".$_GET[oid]."'");
 //print_r($cart_item);
  for($k=0;$k<count($cart_item);$k++){
	  $arr_list = $db->select("SELECT name,quality1,quality2,quality3,quantity,price,model,unit,iid,stock,batch FROM `".tablepre."stock_item` where iid = '".$cart_item[$k][6]."' and sale = '1' ");
	 // print_r($arr_list);
	  /*
	  }
  $arr_list = $db->select("SELECT name,quality1,quality2,quality3,quantity,price,model,unit,iid FROM `".tablepre."stock_item` where sid = '".$array_stock[$i][0]."' and sale = '1' ");
		for($j=0;$j<count($arr_list);$j++) {*/ ?>
        <tr><td valign="top" style="width:70px;">&nbsp;</td>
        <td><? echo $arr_list[0][10]; ?></td>
        <td><? echo $arr_list[0][6]==''?attachment(1,$array_stock[$i][3],model):$arr_list[0][6]; ?></td>
        <td><? echo $cart_item[0][4]; ?></td>
        <td><? echo $arr_list[0][3]; ?></td>
        <td><? echo $arr_list[0][1]; ?></td>
        <td><? echo $arr_list[0][2]; ?></td>
        <td><? echo unit(price_descount($checkmember[0][2],$arr_list[0][5])); ?></td>
        <td><? echo unit($cart_item[0][5]); ?></td>
        </tr>
  <?
  if($_POST){
	  $last_order_id = $db->select("SELECT oid FROM `".tablepre."order` order by oid desc limit 1");


	  
	  }
		}
		
		
  ?>
  
  
  <? }
  if($_POST){

	  	header("Location: pay.php?oid=".$last_order_id[0][0] );
	exit;
	  }
   ?>
        <tr >
    <td colspan="9"  bgcolor="#EEEEEE" ><div style="margin:5px; font-size:16px;"><? echo PRODUCT_TOTAL.': '.unit(order_total(1,$_GET[oid]));?>&nbsp; | &nbsp;<? echo PAY_ITEM_QUANTITY.'：'.order_total(2,$_GET[oid]);?></div></td>
    </tr>
</table>

</div>
<? }?>
</div>
<div id="print_button" style="width:32px; height:32px;"><a href="javascript:void(0);"><img src="../images/print.png" /></a></div>
</body>
</html>
